package com.gitee.ly.ymorm;

import com.gitee.ly.ymorm.transaction.TransactionFactory;

import javax.sql.DataSource;

/**
 * YmOrmEnvironment
 *
 * @author ly
 **/
public class YmOrmEnvironment {
    private final String id;
    private final DataSource dataSource;
    private final TransactionFactory transactionFactory;

    public YmOrmEnvironment(String id, DataSource dataSource, TransactionFactory transactionFactory) {
        if (id == null) {
            throw new YmOrmException("'id' must not be null");
        }
        if (dataSource == null) {
            throw new YmOrmException("'dataSource' must not be null");
        }
        if (transactionFactory == null) {
            throw new YmOrmException("'transactionFactory' must not be null");
        }
        this.id = id;
        this.dataSource = dataSource;
        this.transactionFactory = transactionFactory;
    }

    public String getId() {
        return this.id;
    }

    public TransactionFactory getTransactionFactory() {
        return this.transactionFactory;
    }

    public DataSource getDataSource() {
        return this.dataSource;
    }

}
